<template>
  <p>ClearTimer Component</p>
  <router-link to="/">Go Home & Clear Timer</router-link>
</template>

<script>
import { createApp, ref, reactive, computed, onMounted, onUnmounted } from 'vue';

export default {
  name: "ClearTimer",
  setup(props, ctx) {
    let i = 1;
    const timer = setInterval(() => {
      console.log(i)
      i += 1
    }, 500);
    onUnmounted(() => clearInterval(timer))
  }
}
</script>

<style scoped>

</style>